package com.mvc.controller;


import com.common.core.BaseController;
import com.jfinal.kit.JsonKit;
import com.mvc.request.ReqPage;
import com.mvc.request.ReqSendMessage;
import com.mvc.request.ReqVenueMessagePage;
import com.mvc.request.ReturnData;
import com.mvc.response.RspMessage;
import com.mvc.response.RspPage;
import com.mvc.service.MessageService;
import com.mvc.service.impl.MessageServiceImpl;

/**
 * 留言
 */
public class MessageController extends BaseController {

	MessageService messageService = new MessageServiceImpl();

	// 根据场馆ID，新增场馆留言
	public void sendMessage() {

		ReqSendMessage req = getRequestObject(ReqSendMessage.class);
		ReturnData<Boolean> data = messageService.create(req);
		renderJson(JsonKit.toJson(data));
	}

	// 获取最新留言列表
	public void queryNewPage() {
		ReqPage req = getRequestObject(ReqPage.class);
		ReturnData<RspPage<RspMessage>> data = messageService.queryNewPage(req);
		renderJson(JsonKit.toJson(data));
	}

	// 根据场馆ID获取场馆留言列表
	public void queryVenuePage() {
		ReqVenueMessagePage req = getRequestObject(ReqVenueMessagePage.class);
		ReturnData<RspPage<RspMessage>> data = messageService.queryVenuePage(req);
		renderJson(JsonKit.toJson(data));
	}
}
